import type { TreeNodeData } from "../../components/SearchTreeResults";
import type { User } from "../../services/userService";
/**
 * 模拟组织架构树数据
 */

export interface organizationTreeData {
  name: string;
  orgId: number;
  parentId?: number;
  path?: string;
  children?: organizationTreeData[];
}

export const mockOrganizationTreeData: organizationTreeData[] = [
  {
    name: "总行",
    orgId: 1,
    parentId: 1009,
    path: "1009:21",
    children: [
      {
        name: "行政管理中心",
        orgId: 11,
        parentId: 1,
        path: "1009:21:1",
        children: [
          {
            name: "人力资源部",
            orgId: 111,
            parentId: 11,
            path: "1009:21:1:1",
          },
          {
            name: "财务部",
            orgId: 112,
            parentId: 11,
            path: "1009:21:1:2",
          },
        ],
      },
      {
        name: "技术中心",
        orgId: 12,
        parentId: 1,
        path: "1009:21:2",
        children: [
          {
            name: "研发部",
            orgId: 121,
            parentId: 12,
            path: "1009:21:2:1",
          },
          {
            name: "运维部",
            orgId: 122,
            parentId: 12,
            path: "1009:21:2:2",
          },
        ],
      },
    ],
  },
  {
    name: "分行",
    orgId: 2,
    parentId: 1010,
    path: "1010:22",
    children: [
      {
        name: "北京分行",
        orgId: 21,
        parentId: 2,
        path: "1010:22:1",
        children: [
          {
            name: "销售部",
            orgId: 211,
            parentId: 21,
            path: "1010:22:1:1",
          },
          {
            name: "客服部",
            orgId: 212,
            parentId: 21,
            path: "1010:22:1:2",
          },
        ],
      },
      {
        name: "上海分行",
        orgId: 22,
        parentId: 2,
        path: "1010:22:2",
        children: [
          {
            name: "市场部",
            orgId: 221,
            parentId: 22,
            path: "1010:22:2:1",
          },
          {
            name: "运营部",
            orgId: 222,
            parentId: 22,
            path: "1010:22:2:2",
          },
        ],
      },
    ],
  },
];

/**
 * 模拟人员列表
 */
export const mockUsers: User[] = [
  {
    id: 10001,
    userId: "U10001",
    name: "张三",
    orgId: 1,
    orgName: "总行",
    email: "zhangsan@example.com",
    role: "员工",
    avatar: getRandomAvatar(),
    status: 1, // active
    createAt: "2023-01-01T08:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-10T18:30:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "zhangsan001",
    empNo: getRandomEmpNo(),
  },
  {
    id: 10002,
    userId: "U10002",
    name: "李四",
    orgId: 1,
    orgName: "总行",
    email: "lisi@example.com",
    role: "经理",
    avatar: getRandomAvatar(),
    status: 1, // active
    createAt: "2023-01-02T09:15:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-11T20:45:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "lisi002",
    empNo: getRandomEmpNo(),
  },
  {
    id: 10003,
    userId: "U10003",
    name: "王五",
    orgId: 11,
    orgName: "行政管理中心",
    email: "wangwu@example.com",
    role: "员工",
    avatar: getRandomAvatar(),
    status: 0, // inactive
    createAt: "2023-01-03T10:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-12T22:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "wangwu003",
    empNo: getRandomEmpNo(),
  },
  {
    id: 10004,
    userId: "U10004",
    name: "赵六",
    orgId: 11,
    orgName: "行政管理中心",
    email: "zhaoliu@example.com",
    role: "主管",
    avatar: getRandomAvatar(),
    status: 1, // active
    createAt: "2023-01-04T11:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-13T23:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "zhaoliu004",
    empNo: getRandomEmpNo(),
  },
  {
    id: 10005,
    userId: "U10005",
    name: "孙七",
    orgId: 111,
    orgName: "人力资源部",
    email: "sunqi@example.com",
    role: "员工",
    avatar: getRandomAvatar(),
    status: 1, // active
    createAt: "2023-01-05T12:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-14T00:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "sunqi005",
    empNo: getRandomEmpNo(),
  },
  {
    id: 10006,
    userId: "U10006",
    name: "周八",
    orgId: 112,
    orgName: "财务部",
    email: "zhouba@example.com",
    role: "员工",
    avatar: getRandomAvatar(),
    status: 0, // inactive
    createAt: "2023-01-06T13:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-15T01:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "zhouba006",
    empNo: getRandomEmpNo(),
  },
  {
    id: 10007,
    userId: "U10007",
    name: "吴九",
    orgId: 12,
    orgName: "技术中心",
    email: "wujie@example.com",
    role: "经理",
    avatar: getRandomAvatar(),
    status: 1, // active
    createAt: "2023-01-07T14:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-16T02:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "wujie007",
    empNo: getRandomEmpNo(),
  },
  {
    id: 98,
    userId: "U98",
    name: "郑十",
    orgId: 12,
    orgName: "技术中心",
    email: "zhengshi@example.com",
    role: "员工",
    avatar: getRandomAvatar(),
    status: 0, // inactive
    createAt: "2023-01-08T15:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-17T03:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "zhengshi008",
    empNo: getRandomEmpNo(),
  },
  {
    id: 99,
    userId: "U99",
    name: "王十一",
    orgId: 121,
    orgName: "研发部",
    email: "wangshiyi@example.com",
    role: "员工",
    avatar: getRandomAvatar(),
    status: 1, // active
    createAt: "2023-01-09T16:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-18T04:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "wangshiyi009",
    empNo: getRandomEmpNo(),
  },
  {
    id: 910,
    userId: "U910",
    name: "李十二",
    orgId: 122,
    orgName: "运维部",
    email: "lishier@example.com",
    role: "主管",
    avatar: getRandomAvatar(),
    status: 1, // active
    createAt: "2023-01-10T17:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-19T05:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "lishier010",
    empNo: getRandomEmpNo(),
  },
  {
    id: 911,
    userId: "U911",
    name: "陈十三",
    orgId: 2,
    orgName: "分行",
    email: "chenshisan@example.com",
    role: "员工",
    avatar: getRandomAvatar(),
    status: 0, // inactive
    createAt: "2023-01-11T18:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-20T06:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "chenshisan011",
    empNo: getRandomEmpNo(),
  },
  {
    id: 912,
    userId: "U912",
    name: "杨十四",
    orgId: 2,
    orgName: "分行",
    email: "yangshisi@example.com",
    role: "经理",
    avatar: getRandomAvatar(),
    status: 1, // active
    createAt: "2023-01-12T19:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-21T07:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "yangshisi012",
    empNo: getRandomEmpNo(),
  },
  {
    id: 913,
    userId: "U913",
    name: "朱十五",
    orgId: 21,
    orgName: "北京分行",
    email: "zhushiwu@example.com",
    role: "员工",
    avatar: getRandomAvatar(),
    status: 1, // active
    createAt: "2023-01-13T20:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-22T08:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "zhushiwu013",
    empNo: getRandomEmpNo(),
  },
  {
    id: 914,
    userId: "U914",
    name: "秦十六",
    orgId: 21,
    orgName: "北京分行",
    email: "qinshiliu@example.com",
    role: "主管",
    avatar: getRandomAvatar(),
    status: 0, // inactive
    createAt: "2023-01-14T21:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-23T09:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "qinshiliu014",
    empNo: getRandomEmpNo(),
  },
  {
    id: 915,
    userId: "U915",
    name: "何十七",
    orgId: 211,
    orgName: "销售部",
    email: "heshiqi@example.com",
    role: "员工",
    avatar: getRandomAvatar(),
    status: 1, // active
    createAt: "2023-01-15T22:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-24T10:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "heshiqi015",
    empNo: getRandomEmpNo(),
  },
  {
    id: 916,
    userId: "U916",
    name: "吕十八",
    orgId: 212,
    orgName: "客服部",
    email: "lvshiba@example.com",
    role: "员工",
    avatar: getRandomAvatar(),
    status: 0, // inactive
    createAt: "2023-01-16T23:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-25T11:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "lvshiba016",
    empNo: getRandomEmpNo(),
  },
  {
    id: 917,
    userId: "U917",
    name: "施十九",
    orgId: 22,
    orgName: "上海分行",
    email: "shishijiu@example.com",
    role: "经理",
    avatar: getRandomAvatar(),
    status: 1, // active
    createAt: "2023-01-17T00:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-26T12:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "shishijiu017",
    empNo: getRandomEmpNo(),
  },
  {
    id: 918,
    userId: "U918",
    name: "张二十",
    orgId: 22,
    orgName: "上海分行",
    email: "zhangershi@example.com",
    role: "员工",
    avatar: getRandomAvatar(),
    status: 0, // inactive
    createAt: "2023-01-18T01:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-27T13:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "zhangershi018",
    empNo: getRandomEmpNo(),
  },
  {
    id: 919,
    userId: "U919",
    name: "李二十一",
    orgId: 221,
    orgName: "市场部",
    email: "liershiyi@example.com",
    role: "员工",
    avatar: getRandomAvatar(),
    status: 1, // active
    createAt: "2023-01-19T02:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-28T14:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "liershiyi019",
    empNo: getRandomEmpNo(),
  },
  {
    id: 920,
    userId: "U920",
    name: "王二十二",
    orgId: 222,
    orgName: "运营部",
    email: "wangershier@example.com",
    role: "主管",
    avatar: getRandomAvatar(),
    status: 1, // active
    createAt: "2023-01-20T03:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-29T15:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "wangershier020",
    empNo: getRandomEmpNo(),
  },
  {
    id: 921,
    userId: "U921",
    name: "赵二十三",
    orgId: 1,
    orgName: "总行",
    email: "zhaoesansan@example.com",
    role: "员工",
    avatar: getRandomAvatar(),
    status: 0, // inactive
    createAt: "2023-01-21T04:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-30T16:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "zhaoesansan021",
    empNo: getRandomEmpNo(),
  },
  {
    id: 922,
    userId: "U922",
    name: "孙二十四",
    orgId: 11,
    orgName: "行政管理中心",
    email: "sunesier@example.com",
    role: "员工",
    avatar: getRandomAvatar(),
    status: 1, // active
    createAt: "2023-01-22T05:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-31T17:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "sunesier022",
    empNo: getRandomEmpNo(),
  },
  {
    id: 923,
    userId: "U923",
    name: "周二十五",
    orgId: 12,
    orgName: "技术中心",
    email: "zhoueswu@example.com",
    role: "员工",
    avatar: getRandomAvatar(),
    status: 0, // inactive
    createAt: "2023-01-23T06:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-02-01T18:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "zhoueswu023",
    empNo: getRandomEmpNo(),
  },
  {
    id: 924,
    userId: "U924",
    name: "吴二十六",
    orgId: 2,
    orgName: "分行",
    email: "wuesliu@example.com",
    role: "经理",
    avatar: getRandomAvatar(),
    status: 1, // active
    createAt: "2023-01-24T07:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-02-02T19:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "wuesliu024",
    empNo: getRandomEmpNo(),
  },
  {
    id: 925,
    userId: "U925",
    name: "郑二十七",
    orgId: 21,
    orgName: "北京分行",
    email: "zhengesqi@example.com",
    role: "员工",
    avatar: getRandomAvatar(),
    status: 0, // inactive
    createAt: "2023-01-25T08:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-02-03T20:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "zhengesqi025",
    empNo: getRandomEmpNo(),
  },
  {
    id: 926,
    userId: "U926",
    name: "王二十八",
    orgId: 22,
    orgName: "上海分行",
    email: "wangesba@example.com",
    role: "员工",
    avatar: getRandomAvatar(),
    status: 1, // active
    createAt: "2023-01-26T09:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-02-04T21:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "wangesba026",
    empNo: getRandomEmpNo(),
  },
  {
    id: 927,
    userId: "U927",
    name: "李二十九",
    orgId: 111,
    orgName: "人力资源部",
    email: "liersjiu@example.com",
    role: "员工",
    avatar: getRandomAvatar(),
    status: 0, // inactive
    createAt: "2023-01-27T10:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-02-05T22:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "liersjiu027",
    empNo: getRandomEmpNo(),
  },
  {
    id: 928,
    userId: "U928",
    name: "陈三十",
    orgId: 122,
    orgName: "运维部",
    email: "chensanshi@example.com",
    role: "主管",
    avatar: getRandomAvatar(),
    status: 1, // active
    createAt: "2023-01-28T11:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-30T23:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "chensanshi028",
    empNo: getRandomEmpNo(),
  },
  {
    id: 929,
    userId: "U929",
    name: "杨三十一",
    orgId: 212,
    orgName: "客服部",
    email: "yangsanshiyi@example.com",
    role: "员工",
    avatar: getRandomAvatar(),
    status: 0, // inactive
    createAt: "2023-01-29T12:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-01-31T00:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "yangsanshiyi029",
    empNo: getRandomEmpNo(),
  },
  {
    id: 930,
    userId: "U930",
    name: "朱三十二",
    orgId: 221,
    orgName: "市场部",
    email: "zhusanshier@example.com",
    role: "员工",
    avatar: getRandomAvatar(),
    status: 1, // active
    createAt: "2023-01-30T13:00:00+08:00", // 修改为 createAt，时间精确到秒并带时区
    updateAt: "2023-02-01T01:00:00+08:00", // 修改为 updateAt，时间精确到秒并带时区
    empAccount: "zhusanshier030",
    empNo: getRandomEmpNo(),
  },
];

// 工具函数：随机生成 empNo，格式为 P1234567 或 C1234567
function getRandomEmpNo(): string {
  const prefix = Math.random() > 0.5 ? "P" : "C";
  const randomNumber = Math.floor(1000000 + Math.random() * 9000000); // 生成 7 位随机数字
  return `${prefix}${randomNumber}`;
}

// 工具函数：随机从 "1", "2", "3", "4" 中取值
function getRandomAvatar(): string {
  const avatars = ["1", "2", "3", "4"];
  return avatars[Math.floor(Math.random() * avatars.length)];
}

export default {
  mockOrganizationTreeData,
  mockUsers,
};
